<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>五子棋精品版</title>
    <style>
        :root {
            --primary-color: #8B4513;
            --board-color: #E8C192;
            --highlight-color: #F0D4A8;
            --shadow-color: rgba(0, 0, 0, 0.25);
        }
        
        body {
            font-family: 'Arial', sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            overflow: hidden;
        }
        
        .container {
            display: flex;
            flex-direction: column;
            align-items: center;
            max-width: 800px;
            width: 100%;
            padding: 10px;
            box-sizing: border-box;
        }
        
        .game-area {
            display: flex;
            flex-direction: column;
            align-items: center;
            width: 100%;
        }
        
        .canvas-container {
            position: relative;
            margin-bottom: 15px;
        }
        
        canvas {
            display: block;
            box-shadow: 0 8px 24px rgba(0,0,0,0.1);
            border-radius: 5px;
        }
        
        h1 {
            color: #333;
            text-align: center;
            margin-bottom: 20px;
            text-shadow: 1px 1px 3px rgba(0,0,0,0.1);
        }
        
        .status {
            font-size: 1.2em;
            margin: 10px 0;
            padding: 8px 15px;
            background: rgba(255,255,255,0.8);
            border-radius: 20px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.05);
            width: 100%;
            text-align: center;
            transition: all 0.3s ease;
        }
        
        .controls {
            display: flex;
            justify-content: center;
            flex-wrap: wrap;
            gap: 10px;
            margin-top: 10px;
            margin-bottom: 15px;
            width: 100%;
        }
        
        button {
            padding: 10px 20px;
            font-size: 1em;
            background: linear-gradient(to bottom, #6a11cb 0%, #2575fc 100%);
            color: white;
            border: none;
            border-radius: 20px;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: 0 4px 10px rgba(0,0,0,0.1);
            min-width: 100px;
        }
        
        button:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 15px rgba(0,0,0,0.15);
        }
        
        button:active {
            transform: translateY(1px);
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        }
        
        button:disabled {
            background: #cccccc;
            cursor: not-allowed;
        }
        
        .black-turn {
            background-color: #333;
            color: white;
        }
        
        .white-turn {
            background-color: #f5f5f5;
            color: #333;
            border: 1px solid #ddd;
        }
        
        .game-over-dialog {
            display: none;
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: white;
            padding: 20px;
            border-radius: 10px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.2);
            z-index: 100;
            text-align: center;
        }
        
        .history-container {
            position: fixed;
            right: 20px;
            top: 20px;
            background: rgba(255, 255, 255, 0.9);
            padding: 10px;
            border-radius: 10px;
            max-height: 80vh;
            overflow-y: auto;
            box-shadow: 0 5px 15px rgba(0,0,0,0.1);
        }
        
        /* 响应式布局 */
        @media (max-width: 600px) {
            .container {
                padding: 5px;
            }
            
            h1 {
                font-size: 1.5em;
            }
            
            .status {
                font-size: 1em;
            }
            
            button {
                padding: 8px 15px;
                font-size: 0.9em;
            }
        }
        
        /* 确保控制按钮在小屏幕上正确显示 */
        @media (max-height: 800px) {
            .container {
                padding-bottom: 60px;
            }
            
            body {
                overflow-y: auto;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>五子棋精品版</h1>
        <div class="game-area">
            <div class="canvas-container">
                <canvas id="gameCanvas" width="450" height="450" tabindex="0" aria-label="五子棋棋盘" role="application"></canvas>
                <div id="currentPositionMarker"></div>
            </div>
            <div class="controls">
                <button id="undoButton" onclick="undoMove()" aria-label="悔棋">悔棋</button>
                <button id="saveButton" onclick="saveGame()" aria-label="保存游戏">保存游戏</button>
                <button id="loadButton" onclick="loadGame()" aria-label="读取游戏">读取游戏</button>
                <button id="restartButton" onclick="resetGame()" aria-label="重新开始">重新开始</button>
            </div>
        </div>
        <div class="status" id="gameInfo">当前轮到黑棋</div>
    </div>
    
    <div id="gameOverDialog" class="game-over-dialog" role="dialog" aria-modal="true" aria-labelledby="gameOverMessage">
        <p id="gameOverMessage"></p>
        <button onclick="resetGame()" aria-label="重新开始游戏">重新开始</button>
    </div>
    
    <div id="moveHistory" class="history-container" style="display: none;">
        <h3>棋局记录</h3>
        <div id="moveList"></div>
    </div>
    
    <!-- 音效资源 (Base64编码，减少HTTP请求) -->
    <audio id="moveSound" preload="auto">
        <source src="data:audio/mpeg;base64,SUQzBAAAAAABEVRYWFgAAAAtAAADY29tbWVudABCaWdTb3VuZEJhbmsuY29tIC8gTGFTb25vdGhlcXVlLm9yZwBURU5DAAAAHQAAA1N3aXRjaCBQbHVzIMKpIE5DSCBTb2Z0d2FyZQBUSVQyAAAABgAAAzIyMzUAVFNTRQAAAA8AAANMYXZmNTcuODMuMTAwAAAAAAAAAAAAAAD/80DEAAAAA0gAAAAATEFNRTMuMTAwVVVVVVVVVVVVVUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVf/zQsRbAAADSAAAAABVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVf/zQMSkAAADSAAAAABVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV" type="audio/mpeg">
    </audio>
    <audio id="winSound" preload="auto">
        <source src="data:audio/mpeg;base64,SUQzBAAAAAABEVRYWFgAAAAtAAADY29tbWVudABCaWdTb3VuZEJhbmsuY29tIC8gTGFTb25vdGhlcXVlLm9yZwBURU5DAAAAHQAAA1N3aXRjaCBQbHVzIMKpIE5DSCBTb2Z0d2FyZQBUSVQyAAAABgAAAzIyMzUAVFNTRQAAAA8AAANMYXZmNTcuODMuMTAwAAAAAAAAAAAAAAD/80DEA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VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV" type="audio/mpeg">
    </audio>
    
    <script>
        // JavaScript代码将在这里编写
    </script>
</body>
</html>
</html>